package 牛客_面试必刷.Month07.day07;

public class 反转链表 {
    public ListNode ReverseList(ListNode head) {
        //这种的是定义虚拟节点的
        ListNode fast = null;
        ListNode slow = head;
        ListNode tmp = null;
        while (slow != null){
            fast = slow.next;
            slow.next = tmp;
            tmp = slow;
            slow = fast;
        }
        return tmp;
    }
}
